package cn.fjsay.java.demo2;

public class ManTest {
    public static void main(String[] args) {
        Man tom=new Man();
        Man jack=new YoungMan();
        Man nary=new OldMan();
        tom.drink();
        jack.drink();
        nary.drink();
        if(jack instanceof YoungMan){
            ((YoungMan)jack).dance();
        }

    }
}
